package com.oo.polymorphic_4.drink;

import java.util.Scanner;

/**
 * DrinkTest--${description}
 *
 * @author: Jovi
 * @createTime: 2017-05-09 16:00
 **/
public class DrinkTest {

    public static void main(String[] args) {

        System.out.println("请选择饮料：（1.咖啡，2.矿泉水，3.可乐）");
        Scanner sc = new Scanner(System.in);
        int id = sc.nextInt();
        Drink d = DrinkFactory.getDrink(id);
        if (d != null) {
            System.out.println("请输入购买的容量");
            int num = sc.nextInt();
            d.setCapacity(num);
            d.buy();
        }
    }
}
